@extends('admin.common.base-master')

@section('html-head')

@endsection

@section('html-body')
    <div id="content">
        <!-- cur-position start -->
        <div id="cur-position">
            <span class="tit">当前位置：</span>
            <a href="{{route('Admin.Home.getUserChargeRecord')}}">查看余额记录</a>
        </div>
        @include('admin.common.users-header')
        <div class="filter-box clearfix">
            <div class="fr">
                @if($type!='used')
                    <a class="addBtn" style="width: 120px" href="{{route('Admin.Home.getUserChargeRecord').'?user_id='.$user_id.'&type=used'}}"  class="openimg" >切换为消费记录</a>
                @else
                    <a class="addBtn" style="width: 120px" href="{{route('Admin.Home.getUserChargeRecord').'?user_id='.$user_id}}"  class="openimg" >切换为充值记录</a>
                @endif
            </div>
        </div>
        <div class="table-box">
            <table class="table">
                <thead>
                <tr>
                    <th>用户id</th>
                    <th>用户昵称</th>
                    <th>手机</th>
                    @if($type=='used')
                        <th>订单号</th>
                        <th>消费金额（单位：元）</th>
                    @else
                        <th>充值金额（单位：元）</th>
                    @endif

                    <th>备注</th>
                    <th>发生时间</th>
                </tr>
                </thead>
                <tbody>
                @if($type=='used')
                    @if(count($detail) > 0)
                        @foreach($detail as $item)
                            <tr>
                                <td>{{$item->user_id}}</td>
                                <td>{{$item->nickname}}</td>
                                <td>{{$item->phone}}</td>
                                <td>{{$item->order_num}}</td>
                                <td>{{$item->amount}}</td>
                                <td>{{$item->remark ? $item->remark : ''}}</td>
                                <td>{{$item->created_at}}</td>
                            </tr>
                        @endforeach
                    @endif
                @else
                    @if(count($detail) > 0)
                        @foreach($detail as $item)
                            <tr>
                                <td>{{$item->user_id}}</td>
                                <td>{{$item->nickname}}</td>
                                <td>{{$item->phone}}</td>
                                <td>{{$item->charge_money}}</td>
                                <td>{{$item->remark ? $item->remark : ''}}</td>
                                <td>{{$item->created_at}}</td>
                            </tr>
                        @endforeach
                    @endif
                @endif
                </tbody>
            </table>
        </div>
        <div class="pagelist" style="text-align: center;">
            <?php echo $detail->appends(['user_id'=>$user_id,'type'=>$type])->render(); ?>
        </div>
    </div>
@endsection